package com.szsfm.vehiclemanagement.manager;

import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.FormatStrategy;
import com.orhanobut.logger.Logger;
import com.orhanobut.logger.PrettyFormatStrategy;

/**
 * Created by zhoubigbo on 2017/11/20.
 */
public class LoggerManager {

    private static final String LOG_PREFIX = "[HEDH]";

    private static LoggerManager instance;

    private LoggerManager() {
    }

    public static LoggerManager getInstance() {
        if (instance == null) instance = new LoggerManager();
        return instance;
    }

    public void init() {
        FormatStrategy strategy = PrettyFormatStrategy.newBuilder().showThreadInfo(false)  // (Optional) Whether to show thread info or not. Default true
                .methodCount(2)         // (Optional) How many method line to show. Default 2
                .methodOffset(7)        // (Optional) Hides internal method calls up to offset. Default 5
                .logStrategy(null) // (Optional) Changes the log strategy to print out. Default LogCat
                .tag(LOG_PREFIX)   // (Optional) Global tag for every log. Default PRETTY_LOGGER
                .build();
        AndroidLogAdapter adapter = new AndroidLogAdapter(strategy);
        Logger.addLogAdapter(adapter);
    }


}
